﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="frm_Preguntas.aspx.cs" Inherits="ED_Nivelacion.PresentacionWeb.frm_Preguntas" EnableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style17 {
            width: 445px;
        }

        .auto-style18 {
            width: 329px;
        }

        .auto-style20 {
            width: 20px;
        }

        .auto-style21 {
            width: 107px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="Form1" runat="server">

        <script>
            function show() {
                document.write("<head id='head2' runat='server'></head>");
            }
</script>

         <script>
             $(document).ready(function () {

                 $(document).on("click", ".editar", function () {

                     var item = $(this).data("item");
                     var criterio = $(this).data("criterio");
                     var orden = $(this).data("orden");
                     var id = $(this).data("id");

                     //alert(id_v);


                     $('#ContentPlaceHolder1_txt_Pregunta').val(item);
                     $('#cbm_Criterio').val(criterio);
                     $('#ContentPlaceHolder1_txt_Orden').val(orden);
                     $('#ContentPlaceHolder1_txt_Editar').val(id);
                     $('#ContentPlaceHolder1_Btn_Modificar_Preguntass').show();
                     $('#ContentPlaceHolder1_Btn_Guardar_Preguntas').hide();
                 });

                 $(document).on("click", ".guardar", function () {
                     $('#ContentPlaceHolder1_Btn_Modificar_Preguntass').hide();
                     $('#ContentPlaceHolder1_Btn_Guardar_Preguntas').show();
                 });
             });

             function eliminar(idCriterio_Evaluacion) {

                 var id = $(this).data("id");
                 alert(id);
                 $('#ContentPlaceHolder1_idEliminar').val(id)
             }

             function limpiar() {
                 $('#ContentPlaceHolder1_txt_Pregunta').val("");
                 $('#cbm_Criterio').val("0");
                 $('#ContentPlaceHolder1_txt_Orden').val("");
                 $('#ContentPlaceHolder1_txt_Editar').val("");
             }


</script>


        <%
            ED_Nivelacion.Negocios.Preguntas_C _objPreguntas = new ED_Nivelacion.Negocios.Preguntas_C();
            ED_Nivelacion.Negocios.CriterioEvaluacion_C _objCriterios = new ED_Nivelacion.Negocios.CriterioEvaluacion_C(); %>
        <div class="row">


            <!-- /. ROW  -->

            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                                            <asp:ScriptManager ID="ScriptManager1" runat="server">
                                </asp:ScriptManager>
&nbsp;<asp:Timer ID="Timer1" runat="server">
                                </asp:Timer>
                    <div class="panel panel-default">
                        <div class="panel-body">
                            <div class="table-responsive">


                                <br />
                                <br />

                                <div class="col-lg-12">

                                    <div class="portlet portlet-default">
                                        <div class="portlet-heading">
                                            <div class="portlet-title">
                                                <h4>Agregar Preguntas</h4>
                                                
                                            </div>
                                            <div class="clearfix">
                                                <div class="portlet-widgets">
                                                    <a class="btn btn-success btn-xs guardar" data-toggle="modal" data-target="#AgregarPregunta" onclick="limpiar()"><i class="fa fa-plus">Agregar </i></a>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="portlet-body">
                                            <div class="table-responsive">
                                                <table id="example-table" class="table table-striped table-bordered table-hover table-green">
                                                    <thead>
                                                        <tr>
                                                            <th class="auto-style20">#</th>
                                                            <th class="auto-style17">PREGUNTA</th>
                                                            <th class="auto-style18">CRITERIO DE EVALUACIÓN</th>
                                                            <th class="auto-style21">ORDEN</th>
                                                            <th>ACCIÓN</th>
                                                        </tr>
                                                    </thead>
                                                    <tbody>
                                                        <% foreach (var item in _objPreguntas.ObtenerPreguntas())
                                                           {
                                                               
                                                           %>
                                                        <tr class="odd gradeX">
                                                            <td class="auto-style20"><%=item.idPreguntas %></td>
                                                            <td class="auto-style17"><%=item.Iten_Pregunta %></td>
                                                            <td class="auto-style18"><%=_objCriterios.FiltrarCriteriosId(item.idCriterio_Evaluacion).FirstOrDefault().Criterio%></td>
                                                            <td class="auto-style21"><%=item.Orden %></td>
                                                            <td class="center"><a class="btn btn-orange btn-sm editar" data-toggle="modal" data-target="#AgregarPregunta" data-id="<%=item.idPreguntas%>" data-item="<%=item.Iten_Pregunta%>" data-criterio="<%=item.idCriterio_Evaluacion%>" data-orden="<%=item.Orden%>"><i class="fa fa-pencil"></i>MODIFICIAR</a>
                                                            </td>
                                                        </tr>
                                                        <%} %>
                                                    </tbody>
                                                    <asp:TextBox ID="idEliminar" runat="server" CssClass="hidden"></asp:TextBox>
                                                </table>
                                            </div>
                                            <!-- /.table-responsive -->
                                        </div>
                                        <!-- /.portlet-body -->
                                    </div>
                                    <!-- /.portlet -->

                                </div>
                            </div>

                        </div>
                    </div>
                    <!-- /. ROW  -->

                </div>
                <!-- /. PAGE INNER  -->
            </div>
            <!-- /. PAGE WRAPPER  -->
        </div>

        <div class="col-lg-22">
            <div class="modal modal-flex fade" id="AgregarPregunta" tabindex="-1" role="dialog" aria-labelledby="flexModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="flexModalLabel">Agregar Preguntas</h4>
                        </div>

                        <div id="Div1" class="modal-body" runat="server">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <asp:TextBox ID="txt_Editar" runat="server" CssClass="hidden"></asp:TextBox>
                                    
                                    <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td class="auto-style17">Pregunta:</td>
                                            <td class="auto-style15">
                                                <asp:TextBox ID="txt_Pregunta" required CssClass="form-control" runat="server"></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="auto-style2">Criterio de Evaluación:</td>
                                            <td class="auto-style16">
                                                <asp:DropDownList ID="cbm_Criterio" CssClass="form-control" style="width: 200px;" ClientIDMode="Static" runat="server" AppendDataBoundItems="true">
                                                    <asp:ListItem Value="" Selected="True">Escoja una opción:</asp:ListItem>
                                                </asp:DropDownList>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="auto-style17">Orden:</td>
                                            <td class="auto-style15">
                                                <asp:TextBox ID="txt_Orden" required CssClass="form-control" runat="server"></asp:TextBox>
                                                <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="txt_Orden" FilterType="Numbers,Custom" ValidChars="." />
                                            </td>
                                        </tr>

                                    </tbody>
                                </table>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">
                            <asp:Button ID="Btn_Guardar_Preguntas" runat="server" CssClass="btn btn-default btn-sm" Text="GUARDAR" OnClick="Btn_Guardar_Preguntas_Click" />
                            <asp:Button ID="Btn_Modificar_Preguntass" runat="server" CssClass="btn btn-default btn-sm" Text="MODIFICAR" OnClick="Btn_Modificar_Preguntass_Click" />

                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
            <!-- /.modal -->
        </div>

    

    <script>

        $('[data-id]').click(function () {
            var Id = $(this).data('id');
            $("#ContentPlaceHolder1_idEliminar").val(Id);
            //alert(Id);
        });
                                                
        $(document).ready(function () {
            $("#cbm_Criterio").searchable(
                {
                    maxListSize: 400,                       // if list size are less than maxListSize, show them all
                    maxMultiMatch: 10,                      // how many matching entries should be displayed
                    exactMatch: false,                      // Exact matching on search       asdasd
                    wildcards: true,                        // Support for wildcard characters (*, ?)
                    ignoreCase: true,                       // Ignore case sensitivity
                    latency: 200,                           // how many millis to wait until starting search
                    warnMultiMatch: 'top {0} matches ...',  // string to append to a list of entries cut short by maxMultiMatch
                    warnNoMatch: 'No existen coincidencias',          // string to show in the list when no entries match
                    zIndex: 'auto'                          // zIndex for elements generated by this plugin
                });
        });
        ///version del browser
        jQuery.browser = {};
        (function () {

            jQuery.browser.msie = false;
            jQuery.browser.version = 0;
            if (navigator.userAgent.match(/MSIE ([0-9]+)\./)) {
                jQuery.browser.msie = true;
                jQuery.browser.version = RegExp.$1;
            }
        })();
    </script>

                    <script>
                        $('[data-paralelo]').click(function () {
                            var Id = $(this).data('paralelo');
                            $("#ContentPlaceHolder1_idEliminar").val(Id);
                            //alert(Id);
                        });
                        $('[data-toggle="confirmation"]').confirmation({
                            placement: 'top', // How to position the confirmation - top | bottom | left | right
                            trigger: 'click', // How confirmation is triggered - click | hover | focus | manual
                            title: 'Esta seguro?', // Default title value if `data-title` attribute isn't present  
                            template: '<div class="popover" >' +
                                '<div class="arrow"></div>' +
                                '<h3 class="popover-title"></h3>' +
                                '<div class="popover-content text-center">' +
                                '<div id="botones" class="btn-group">' +
                                '<asp:LinkButton ID="BtnEliminar" runat="server" CssClass="btn btn-success btn-xs" OnClick="Delete_Click"><i class="fa fa-check-circle icon-white"></i> Si</asp:LinkButton>' +
                                '<a class="btn btn-xs" data-dismiss="confirmation"></a>' +
                                '</div>' +
                                '</div>'
                            , btnOkClass: 'btn-primary'
                            , btnOkIcon: 'fa fa-check-circle'
                            , btnCancelClass: 'btn-danger'
                            , btnOkLabel: 'Si'
                            , btnCancelIcon: 'fa fa-times-circle'
                            , btnCancelLabel: 'No',
                            singleton: true, // Set true to allow only one confirmation to show at a time.
                            popout: false, // Set true to hide the confirmation when user clicks outside of it.
                            onConfirm: function () {

                            }, // Set event when click at confirm button
                            onCancel: function () { }
                        }); // Set event when click at cancel button
                    </script>
        </form>
</asp:Content>
